#-*-coding:utf-8-*-
from django.db import models
from django.contrib import admin
from django.db.models import permalink
from django.contrib.auth.models import User

# Create your models here.
GENDER_CHOICES= (('m', u'先生'), ('f', u'女士'))

class Member(models.Model):
    user = models.ForeignKey(User)
    telephone = models.CharField(max_length = 15, blank = True)
    qq = models.CharField(max_length = 100, blank = True)
    gender = models.CharField(max_length = 1, choices = GENDER_CHOICES, blank = True)
    shareCreatedNum = models.IntegerField(default = 0) #发布的分享
    shareCommentedNum = models.IntegerField(default = 0) #分享的回复
    pinkeCreatedNum = models.IntegerField(default = 0) #发布的拼客
    pinkeJoinedNum = models.IntegerField(default = 0) #参加的拼客
    pinkeCommentedNum = models.IntegerField(default = 0) #拼客的回复
    avatar = models.ImageField(upload_to="avatars", blank = True)

    def __unicode__(self):
        return self.user.username

    @permalink
    def get_absolute_url(self):
        return "/profile/%d/" % self.user.id

admin.site.register(Member)
